/*
 * @Descripttion:
 * @Author: liuxiaoling
 * @Date: 2021-03-22 19:07:54
 * @LastEditors: liuxiaoling
 * @LastEditTime: 2021-04-18 17:28:34
 */
// 兼容 IE
// https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#babelpolyfill
import 'core-js/stable'
import 'regenerator-runtime/runtime'

import Vue from 'vue'
import App from './App.vue'

import router from './router'
import store from './store'
// import store from './store/store.js';
import Viewer from 'v-viewer'
import 'viewerjs/dist/viewer.css'

import SlideVerify from 'vue-monoplasty-slide-verify'
Vue.use(SlideVerify)


import VueQuillEditor from 'vue-quill-editor'
// 引入样式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
Vue.use(VueQuillEditor, /* { 默认全局 } */)


// 引入全局样式
import '@/assets/css/index.scss'
// 设置 js中可以访问 $cdn
import {$cdn} from '@/config'
Vue.prototype.$cdn = $cdn

import signaR from '@/utils/signalR'
Vue.prototype.signaR = signaR

// 图片放大
Vue.use(Viewer, {
  defaultOptions: {
      zIndex: 9999
  }
})

// 二维码插件
import VueQriously from 'vue-qriously'
Vue.use(VueQriously)

//引入复制插件
import VueClipboard from 'vue-clipboard2'
Vue.use(VueClipboard)

import {Switch} from 'vant'
Vue.use(Switch)

import {Notify} from 'vant'
// 全局注册
Vue.use(Notify)

import Mint from 'mint-ui'
import 'mint-ui/lib/style.css'
Vue.use(Mint)

// 全局引入按需引入UI库 vant
import '@/plugins/vant'
import '@vant/touch-emulator'

// 移动端适配
import 'lib-flexible/flexible.js'

// 全局过滤器
import './filters'

import md5 from 'md5'
import {Base64} from 'js-base64'

Vue.prototype.$md5 = md5
Vue.prototype.$Base64 = Base64

Vue.prototype.$getBase64Image = img => {
  var canvas = document.createElement('canvas')
  canvas.width = img.width
  canvas.height = img.height
  var ctx = canvas.getContext('2d')
  ctx.drawImage(img, 0, 0, img.width, img.height)
  var ext = img.src.substring(img.src.lastIndexOf('.') + 1).toLowerCase()
  var dataURL = canvas.toDataURL('image/' + ext)
  return dataURL
}

import axios from 'axios'
Vue.prototype.$axios = axios

import api from './api' // 导入api接口
Vue.prototype.$api = api // 将api挂载到vue的原型上

// 引入nutui
import {Address, Icon, Popup, Button, Elevator, BackTop, FixedNav, Drag, Video} from '@nutui/nutui'

Address.install(Vue)
Icon.install(Vue)
Popup.install(Vue)
Button.install(Vue)
Elevator.install(Vue)
BackTop.install(Vue)
FixedNav.install(Vue)
Drag.install(Vue)
Video.install(Vue)

import {Search} from 'vant'
Vue.use(Search)

Vue.config.productionTip = false
import addStorageEvent from './utils/addStorageEvent'
Vue.prototype.$addStorageEvent = addStorageEvent

import signalr from './utils/signalR'
Vue.use(signalr)

Vue.prototype.$getBase64Image = img => {
  var canvas = document.createElement('canvas')
  canvas.width = img.width
  canvas.height = img.height
  var ctx = canvas.getContext('2d')
  ctx.drawImage(img, 0, 0, img.width, img.height)
  var ext = img.src.substring(img.src.lastIndexOf('.') + 1).toLowerCase()
  var dataURL = canvas.toDataURL('image/' + ext)
  return dataURL
}

// import signalR from './utils/signalR'
// Vue.prototype.sendMsg = signalR.sendMsg

new Vue({
  el: '#app',
  router,
  store,
  //全局事件总线$bus的配置
  beforeCreate() {
    Vue.prototype.$bus = this
  },
  render: h => h(App)
})
